<template>
	<view>
		
	</view>
</template>

<script setup>
	import { reactive, watch } from 'vue';
	import { useUserinfo } from '@/store/userinfo.js'
	import { storeToRefs } from 'pinia'
	import { onShow } from '@dcloudio/uni-app'
	const Userinfo = useUserinfo()
	const { userinfo, hasLogin, isAdminChecker } = storeToRefs(Userinfo)
	const checkAuth = () => {
		console.log(userinfo.value,'userinfo')
		if(userinfo.value.isAuth === 0 && !isAdminChecker.value) {
			uni.navigateTo({
				url: '/pages/auth/auth'
			})
		}
	}
	watch(() => hasLogin.value,val => {
		if(val) {
			checkAuth()
		}
	})
	onShow(() => {
		console.log(userinfo.value,'userinfo1111')
		if(hasLogin.value) {
			checkAuth()
		}
	})
</script>

<style lang="scss">

</style>